package com.metagurukul.metaboard.action;

import java.util.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;

import com.metagurukul.metaboard.dao.NotificationDAO;
import com.metagurukul.metaboard.model.notification.Notification;

public class ShowAction extends Action {
	private final static String SUCCESS = "success";
	private final static String FAILURE = "failure";

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		NotificationDAO notificationDao = new NotificationDAO();

		int sectionId = Integer.parseInt(request.getParameter("sectionId"));
		ArrayList<Notification> notices = new ArrayList<Notification>();
		notices = notificationDao.show(sectionId);

		request.setAttribute("result", notices);
		return mapping.findForward(SUCCESS);
	}

}
